﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MetroStyle
{
    public partial class AlertLabel : Label
    {
        public AlertLabel()
        {
            InitializeComponent();
            this.Visible = false;
        }
        
        public int TimeShow { get { return timer1.Interval; } set { timer1.Interval = value; } }
        public bool ShowInMiddle { get; set; }
        public Form MainForm { get; set; }
        public int top { get; set; }
        public int left { get; set; }

        private void AlertLabel_VisibleChanged(object sender, EventArgs e)
        {
            if (ShowInMiddle)
            {
                this.Location = new Point(MainForm.Width / 2 - this.Width / 2 + left, MainForm.Height / 2 - this.Height + top);
            }
            if (this.Visible)
            {
                timer1.Enabled = true;
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (this.Visible)
            {
                timer1.Enabled = false;
                this.Visible = false;
            }
        }
        
        

    }
}
